import type { UserInfo, CodeType, User } from '@/types/user'
import { request } from '@/utils/request'
// 密码登录
export const loginByPassword = (mobile: string, password: string) =>
  // 如果分开写，用花括号括起来就需要return
  request<User>('/login/password', 'POST', { mobile, password })
// 发送验证码
export const sendMobileCode = (mobile: string, type: CodeType) =>
  request<{ code: string }>('/code', 'GET', { mobile, type })
// 短信验证码登录
export const loginByMobile = (mobile: string, code: string) =>
  request<User>('/login', 'POST', { mobile, code })
// 获取用户详细信息
export const getUserInfo = () => request<UserInfo>('/patient/myUser', 'GET')
